#coding:utf-8  
import os
def delblankline(infile,outfile):
    infopen = open(infile,'r')
    outfopen = open(outfile,'w')
    lines = infopen.readlines()
    for line in lines:
        if line.split():
            outfopen.writelines(line)
        else:
            outfopen.writelines("")
    infopen.close()
    outfopen.close()
    os.remove(infile)
    os.rename(outfile, infile)
delblankline("config.conf","config2.conf")